<!DOCTYPE html>
<html>
<head>
<div th:include="base-libs :: base-libs" />
<title>我的签约患者</title>

<meta name="keywords" content="keyword1,keyword2,keyword3">
<meta name="description" content="this is my page">
<meta name="content-type" content="text/html; charset=UTF-8">

	<style type="text/css">
		body {
			padding: 0px 10px;
		}
		.form-table input{
			width: 206px;
			padding-left: 4px;
		}

		textarea{
			height: 60px;
			padding: 4px;
		}

		.form-table select{
			width: 210px!important;
		}
		.td-text{
			width: 150px;
		}
		.tree-icon{
			display: none;
		}

		.easyui-tabs{
			border-bottom: 1px solid #ccc;
			border-right: 1px solid #ccc;
			border-left: 1px solid #ccc;
			background: #f0f0f0;
		}
		.xzqh-item{
			padding: 2px 10px;
			text-decoration: none !important;
			cursor: pointer;
			margin: 2px 4px;
			display: inline-block;
		}


		.xzqh-unselected:hover {
			background-color: #dcedfe;
		}

		.xzqh-selected {
			background-color: #2e80e6;
			color: #FFF;
		}
		.xzqh-selected:hover {
			color: #FFF!important;
		}
		</style>

<style>
	.laydate-icon{
		width:87% !important;
		padding-left: 5px;
		line-height: 28px;
		background-color: #fff;
		height: 28px;
		border: 1px solid #B6B6B6;
		border-radius: 5px;
	}
	.spanBtn{
		font-weight: bold;
    	color: blue;
    	cursor:pointer;
	}
</style>
<!--[if IE 8.0]>
<style>
	#SHZT{
		position:relative;
		top:3px;
		line-height:30px;
	}
</style>
<![endif]-->
<script th:inline="javascript">
	var xzqhdm = [[${xzqhdm}]];
    var requestData = [[${requestData}]];
</script>
<script>
	$(function(){
        initView();
        $(this).getZydmCache({callback:initData});
    })
    
    function initData(){
        XzqhUtils.getSjxzqh({
            xzqhdm: xzqhdm
            ,callback: function(xzqh){
                $("#xzqhdmPop").quickCombTabXzqh("loadData", xzqh);
                $("#xzqhdmPop").quickCombTabXzqh("setData", xzqhdm);
                $("#xzqhdmPop").quickCombTabXzqh("disable",xzqhdm);
                $("#btnQuery").trigger("click");
            }
        });
	}
    	
    function initView() {
    	//回车查询
    	enterToQuery(btnQueryHandler);

        if(!requestData["isManager"]){
            $("#managerQuery").hide();
        }
		/*机构地址行政区划*/
        $("#xzqhdmPop").quickCombTabXzqh({
            quickConfig: {
                label:'行政区划'
                ,validateProxy:'notNull'
                ,length: '8'
            }
        });

        $("#qyhzTable").datagrid({
            idField : "CWXXBH",
            striped : true,
            clickToSelect: true,
            fitColumns: true,
            fit:true,
            scrollbarSize:15,
            singleSelect: true,
            columns : [[
// 						{field : "xz",checkbox:true},
                {field : "YLJGMC",title : "医疗机构名称",width:180, align:'center', formatter : function(value){
                    return value;
                }},
                {field : "YYJBMC",title : "医院等级",width:60, align:'center'},
                {field : "KSMC",title : "科室名称",width:60, align:'center',formatter:function(value){
//							var reg = /.{8}$/;
//							return value.replace(reg,'********');
                    return value;
                }},
                {field : "BQMC",title : "病区名称",width:60, align:'center'},
                {field : "SJKFCWS",title : "实际开放床位数",width:60, align:'center',formatter:function(value){
                    return value;
                }},
                {field : "DQKCS",title : "当前床位数",width:60, align:'center',formatter:function(value){
                    return value;
                }},
                {field : "YYYCWS",title : "已预约床位数",width:60, align:'center' , formatter: function(value){
                    return value;
                }},
                {field : "DQKYYCWS",title : "可预约床位数",width:70, align:'center',formatter:function(value){
                    return value;
                }},
                {field : "CWSYL",title : "床位使用率",width:40, align:'center',formatter : function(value){
                    return value;
				}}
            ]],
            pagination : true,
            pageList: [10, 20, 50, 100, 200],
            method : "post",
            onBeforeLoad : function(params) {
                var url = $(this).datagrid("options")["url"];
                if (!StringUtils.isEmpty(url)) {
                    params["XZQHDM"] = $("#xzqhdmPop").quickCombTabXzqh("getData");
                    getContainerDataByClassName('conditionBox','condition',params);//查询条件
                    return true;
                } else {
                    return false;
                }
            },
            onClickRow : function(rowIndex, rowData){

            },
            onLoadSuccess: function(data){
// 					alert(JSON.stringify(data))
            },
        });
	}

   	/** 查询  */
   	function btnQueryHandler(){
   		$("#qyhzTable").datagrid({"url":"pageQueryAll.service"});
   	}

   	/** 导出 */
   	function download(){
   	    var params = {};
        params["XZQHDM"] = $("#xzqhdmPop").quickCombTabXzqh("getData");
        getContainerDataByClassName('conditionBox','condition',params);

        var $downloadForm = $("#downloadForm");
        $downloadForm.empty();
        $.each(params, function(key,value){
            var input = $("<input>").attr({value:value,name:key,type:'hidden'});
            $downloadForm.append(input);
		})
        $downloadForm.submit();
   	}
   	
</script>

</head>

<body>
	<div class="easyui-layout" fit="true" border="false">
		<div region="north" style="overflow:hidden;padding:15px 0px;background:#f9f9f9" border="false">
			<form action="queryAllForExcel.service" method="post" enctype="multipart/form-data" id="downloadForm" >
			</form>
			<table class="form-table" id="conditionBox">
				<tr id="managerQuery">
					<td class="td-text">区域：</td>
					<td class="td-content">
						<div id="xzqhdmPop" name="XZQHDM" style="width: 210px; position: relative; border: 1px solid #ccc; cursor: pointer; display: inline-block;">
							<div style="width: 100%; height: 30px; margin-right: 18px; display: inline; padding-left: 4px;">
								<span class="xzqh-content">请选择行政区划</span>
							</div>
							<span class="searchbox-button" style="position: absolute; float: right; right: 0px; margin-top: 5px;"></span>
							<div class="easyui-tabs-container" style="position: fixed">
								<div class="easyui-tabs" data-options="justified:true"
									 style="height: 200px; width: 400px; position: absolute; z-index: 999999; background-color: #FFF; outline: 0;">
									<div title="省份" style="padding:10px">
										<dl>
											<dd>
											</dd>
										</dl>
									</div>
									<div title="城市" style="padding:10px">
										<dl>
											<dd>
											</dd>
										</dl>
									</div>
									<div title="区县" style="padding:10px">
										<dl>
											<dd>
											</dd>
										</dl>
									</div>
									<div title="街道" style="padding:10px">
										<dl>
											<dd>
											</dd>
										</dl>
									</div>
								</div>
							</div>
						</div>
					</td>
					<td class="td-text">医院等级：</td>
					<td class="td-content">
						<select name="YYDJ" cacheTable="TB_ZY_YYDJ" class="form-control condition" style="width: 100%;">
							<option value="">请选择</option>
						</select>
					</td>
					<td class="td-text">医院名称：</td>
					<td class="td-content">
						<!--<select name="RQFL_XMDM"  class="form-control condition" style="width: 100%;">
							<option value="">全部</option>
						</select>-->
						<input name="YLJGMC" id="YLJGMC" class="condition" />
					</td>

				</tr>
				<tr class="activeQuery">
					<td class="td-text">科室名称：</td>
					<td class="td-content">
						<!--<select id="YLTDID" name="YLTDID" class="form-control condition" style="width: 100%;">
							<option value="">全部</option>
						</select>-->
						<input name="KSMC" id="KSMC" class="condition" />
					</td>
					<td class="td-text">病区名称：</td>
					<td class="td-content">
						<input name="BQMC" id="BQMC" class="condition" />
					</td>
					<td class="td-text"></td>
					<td class="td-text" style="width:250px;text-align:center">
						<button id="btnQuery" class="btn btn-info" type="button" onclick="btnQueryHandler()">查询</button>
						<button type="button" onclick="download()">导出</button>
					</td>
				</tr>
			</table>
		</div>
		<div region="center" border="false">
			<table id="qyhzTable" border="false"></table>
		</div>
	</div>
	
</body>
</html>
